package com.java.serverpackage;

import java.io.Serializable;
import java.util.ArrayList;

public class MessagePacket implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 6774447527662045877L;
	private long timeStamp;
	private int id, Aid, Pid, Bid;
	private int members;
	private int[] coordinates;
	private ArrayList<MessagePacket> history;
	
	private boolean okToRemove = false;
	private String msg;
	
	// To send data package with coordinates
	public MessagePacket(int id, int Aid, int Pid, int Bid, int[] coordinates){
		timeStamp = System.currentTimeMillis();

		this.id = id;
		this.Aid = Aid;
		this.Pid = Pid;
		this.Bid = Bid;
		this.coordinates = coordinates;		
	}
	
	// To send a message if a person has joined or quit the game
	public MessagePacket(int id, int members){
		this.id = id;
		this.members = members;
	}
	
	// Message of history to send when new person joins the room
	public MessagePacket(int id,ArrayList<MessagePacket> history) {
		this.id = id;
		this.history = history;
	}
	
	// Send test strings
	public MessagePacket(int id, String msg){
		this.id = id;
		this.msg = msg;
	}
	
	// Send a message to the other players to undo the line with this pid
	// The server also needs to look at this message to remove the line from the history
	public MessagePacket(int id, int pid, boolean okToRemove) {
		this.id = id;
		this.Pid = pid;
		this.okToRemove = okToRemove;
	}
	
	public String getMsg(){
		return msg;
	}
	
	
	//Get methods
	public int getMembers() {
		return members;
	}
		
	public long getTimeStamp() {
		return timeStamp;
	}
	//Action ID
	public int getAid() {
		return Aid;
	}
	//ID code
	public int getId() {
		return id;
	}
	//Path ID
	public int getPid() {
		return Pid;
	}
	//Brush ID
	public int getBid() {
		return Bid;
	}
	
	public int[] getCoordinates() {
		return coordinates;
	}
	
	public ArrayList<MessagePacket> getHistory() {
		return history;
	}
}
